using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Shop;
using System;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class ShowAnnounce : Shop, IRequiresSessionState
{
	protected UserControls_cmpy_Top Top1;
	protected Literal ArticleNav;
	protected Literal AnnounceTitle;
	protected Literal Authour;
	protected Literal WriteDate;
	protected Literal Hits;
	protected Literal AnnounceContent;
	protected Shop_UserControls_ShowProduct ShowProduct65;
	protected Shop_UserControls_ShowProduct ShowProduct59;
	protected UserControls_CMYP_Foot Foot1;
	protected HtmlForm form_1;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Init(object sender, EventArgs e)
	{
		int iD = Fetch.GetID("id");
		if (iD > 0)
		{
			AnnounceBll announceBll = new AnnounceBll(this.conn);
			DataTable announceByAnnounceID = announceBll.GetAnnounceByAnnounceID(iD);
			if (announceByAnnounceID.Rows.Count == 1)
			{
				string text = announceByAnnounceID.Rows[0]["AnnounceTitle"].ToString();
				string text2 = announceByAnnounceID.Rows[0]["AnnounceContent"].ToString();
				this.Authour.Text = announceByAnnounceID.Rows[0]["AnnounceOwner"].ToString();
				string text3 = announceByAnnounceID.Rows[0]["AddTime"].ToString();
				if (text3 != "" || text3 != null)
				{
					try
					{
						this.WriteDate.Text = DateTime.Parse(announceByAnnounceID.Rows[0]["AddTime"].ToString()).ToShortDateString();
					}
					catch
					{
					}
				}
				this.AnnounceTitle.Text = text;
				DateTime t = (announceByAnnounceID.Rows[0]["AnnounceEnd"] == DBNull.Value) ? DateTime.Now.AddMinutes(1.0) : Convert.ToDateTime(announceByAnnounceID.Rows[0]["AnnounceEnd"].ToString());
				if (t >= DateTime.Now)
				{
					this.AnnounceContent.Text = text2;
				}
				else
				{
					this.AnnounceContent.Text = "该公告已过期！";
				}
				this.Hits.Text = announceByAnnounceID.Rows[0]["AnnounceReadCount"].ToString();
				announceBll.UpdateAnnounceReaded(iD);
			}
			else
			{
				this.WriteErrMsg("", Language.Get("Common/NotData"), "");
			}
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
	}
	protected void Page_PreInit(object sender, EventArgs e)
	{
		try
		{
		}
		catch (Exception ex)
		{
			base.WriteTemErrMsg(ex.Message.ToString());
		}
	}
}
